<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<c:url value="/resources/css/view.css"/>" >
</head>
<h1>Address</h1>

<table class="search">
    <tr>
          <th width="200">address1</th>
		  <th width="200">address2</th>
		  <th width="100">city</th>
		  <th width="100">state</th>
		  <th width="100">country</th>
		  <th width="100">zip</th>
		  <th width="100">phone</th>
    </tr>
    
<c:forEach var="address" items="${addresses}" varStatus="status">
    <tr>
    <c:url var="favUrl" value="/customer/address/fav" >
 		<c:param name="id" value="${address.addressId}" />
    </c:url>
    <c:url var="editUrl" value="/customer/address/edit" >
    	<c:param name="id" value="${address.addressId}" />
    </c:url>
    <c:url var="removeUrl" value="/customer/address/remove" >
 		<c:param name="id" value="${address.addressId}" />
    </c:url>
   <td><c:out value="${address.address1}" /></td>
   <td><c:out value="${address.address2}" /></td>
   <td><c:out value="${address.city}" /></td>
   <td><c:out value="${address.state}" /></td>
   <td><c:out value="${address.country}" /></td>
   <td><c:out value="${address.zip}" /></td>
   <td><c:out value="${address.phone}" /></td>
   <td>
        <a href='<c:out value="${favUrl}"/>'>shipping</a>
    </td>
	<td>
        <a href='<c:out value="${editUrl}"/>'>edit</a>
    </td>
    <td>
        <a href='<c:out value="${removeUrl}"/>'>remove</a>
    </td>
    </tr>
</c:forEach>
</table>
<table>
<tr>
<c:if test="${showAdd}">
<c:url var="addUrl" value="/customer/address/add" >
</c:url>
<td width="70">
	<a href='<c:out value="${addUrl}"/>'>add</a>
</td>
</c:if>
	<td><a href="<c:url value="/customer"/>" > back </a></td>
</tr>
</table>
</html>
            